<%
String status = "";
if(request.getSession().getAttribute("status") != null){
	status = (String)request.getSession().getAttribute("status");
}else if(!status.equals("ingelogd")){
	response.sendRedirect("../index.jsp?message=Log+eerst+in+om+verder+te+gaan");
}
//session.removeAttribute("status");
%>
<%@page import="model.*" %>
<%@page import="domein.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

<head>
<title>Incentro Event Inviting System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="../style.css" />

</head>

<body onload="initialize()" onunload="GUnload()">

	<div id="wrapper">
		<div id="header">
			<a href="../eOverzicht.jsp" id="logo"><img src="../img/logo.png" /></a>
		</div>
			<h3>Evenement aanmaken</h3>
			
		<div id="search-form">
			<a href="../eOverzicht.jsp"><input type="submit" value="Terug" class="terugButton" /></a>
		</div>
		
			
		<form id="eventForm" action="../EventToevoegen.do" method="get" >
			<div class="child2 uOpstellenArea1">				
			<%	if(request.getSession().getAttribute("EventStore") != null){
				EventStore es = (EventStore)request.getSession().getAttribute("EventStore");
				request.getSession().removeAttribute("EventStore"); 
				%>
				<span> 
				<label for="contactpersoon">Contactpersoon</label> 
					<select name="contactpersoon">
					<% 
					GebruikersIO gIo = new GebruikersIO();
						for(Gebruiker g : gIo.listGebruikers()){
					%>
						<option value="<%out.print(g.getEmail());%>"><%out.print(g.getVoornaam() +" "+g.getAchternaam()); %></option>
						<%} %>
					</select> 
				<input type="submit" value="Contactpersoon toevoegen" name="contactpersoonToevoegen" id="addContactpersoonButton" onclick="window.location='../voegGebruikerToe.jsp';"/>
				</span>
				
				<br /></br>
				<span> 
					<label for="naam">Titel event</label> <input type="text" id="naam" name="naam" placeholder="Titel evenement" value="<%out.print(es.getTitelEvent()); %>" required />
				</span>
				
				<span> 
					<label for="naam">Subtitel</label> <input type="text" id="subTitel" name="subTitel" value="<%out.print(es.getSubTitel()); %>" required />
				</span>
				 
				<span> 
					<label for="datum">Datum</label> <input type="text" name="datum" id="datum" value="<%out.print(es.getDatum()); %>" required />
				</span>
				 
				 <span> 
					<label for="organisator">Organisator</label> <input type="text" name="organisator" id="organisator" value="<%out.print(es.getOrganisator()); %>" required />
				</span>
				 <%}else{ %>
				 <span> 
				<label for="contactpersoon">Contactpersoon</label> 
					<select name="contactpersoon">
					<% 
					GebruikersIO gIo = new GebruikersIO();
						for(Gebruiker g : gIo.listGebruikers()){
					%>
						<option value="<%out.print(g.getVoornaam() +" "+g.getAchternaam()); %>"><%out.print(g.getVoornaam() +" "+g.getAchternaam()); %></option>
						<%} %>
					</select> 
				</span>
				
				<br /></br>
				<span> 
					<label for="naam">Titel event</label> <input type="text" id="naam" name="naam" placeholder="Titel evenement" required />
				</span>
				
				<span> 
					<label for="naam">Subtitel</label> <input type="text" id="subTitel" name="subTitel" placeholder="Subtitel" required />
				</span>
				 
				<span> 
					<label for="datum">Datum</label> <input type="date" name="datum" id="datum" placeholder="datum" required />
				</span>
				 
				 <span> 
					<label for="organisator">Organisator</label> <input type="text" name="organisator" id="organisator" placeholder="organisator" required />
				</span>
				 <%} %>
				<span> 
				<label for="locatie">Locatie</label> 
					<select name="locatie">
<%
					LocatieIO lIo = new LocatieIO();
						for(Locatie l : lIo.listLocaties()){
					%>
						<option value="<%out.print(l.getLocatieID());%>"><%out.print(l.getAdres()+", "+l.getPlaats()); %></option>
						<%} %>
					</select> 
			</div>

			<input type="submit" name="voegToe" value="Voeg toe" id="form_submit1" />
		
		</form>		
	</div>
</body>

</html>